//
// Created by juno on 2021/9/12.
//

#ifndef WEBCHART_ROOM_MEMBER_H
#define WEBCHART_ROOM_MEMBER_H
#include <libwebsockets.h>
#include "room.h"
#include "ws_server.h"

struct member_base_info {
    char *name;
    char *uuid;
    unsigned int id;
};

struct member_t {
    struct member_base_info *base;
    struct room_t *room;
    struct member_t *next;
    struct per_host_data *host;
    struct per_session_data *session;
};

int member_new(struct member_base_info *base, struct member_t **res);
int member_create_room(struct member_t *member, char *name, struct room_t **res);
int member_join_room(struct member_t *member, const char *name);
int member_leave_room(struct member_t *member);
void member_destroy(struct member_t *member);
int member_change_room(struct member_t *member, const char *name);

#endif //WEBCHART_ROOM_MEMBER_H
